using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Threading;

/// <summary>
/// Summary description for SendEmailNotification
/// </summary>
public class SendEmailNotification
{
    public bool sendEmailNotificationofReservedBookAvailable() 
    {
        DatabaseAccess accessor = new DatabaseAccess();
        DataSet ds = accessor.getReservedBooksToNotify();

        sendEmail.EmailService mailer = new sendEmail.EmailService();

        foreach (DataRow theRow in ds.Tables[0].Rows)
        {
            String Email = theRow["Email"].ToString().Trim();
            String Title = theRow["Title"].ToString().Trim();
            String Author = theRow["Author"].ToString().Trim();
            String Status = theRow["ReserveStatus"].ToString().Trim();

            String Subject = "Reserved Book Available";
            String Body = "<h4>Reserved Book Available</h4>";
            Body += "<p>This is an automated message from the BPI Library System.</p>";
            Body += "<p>The following book that you reserved is now ready to be picked up: ";
            Body += "<br><table>";
            Body += "<tr><td>Title</td><td>Author</td><td>Status</td></tr>";
            Body += "<tr><td>" + Title+"</td><td>"+Author+"</td><td>"+Status+"</td></tr>";
            Body += "</table></p>";

            mailer.sendEmail(Email, Subject,Body);
        }
        return true;
    }    

    public void sendEmailReminderofBooksDueSoon(
        String FirstName, 
        String LastName, 
        String Email, 
        DataSet Books) { }
    public void sendEmailNotificationofBooksOverdue(
        String FirstName, 
        String LastName, 
        String Email, 
        DataSet Books) { }
}
// The delegate must have the same signature as the method
    // you want to call asynchronously.
public delegate bool AsyncReserveNote();